package com.princehan.diy;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;

/**
 * @Description
 * @Author:PrinceHan
 * @CreateTime:2022/4/14 16:14
 */
@Aspect
public class AnnotationPointCut {
    @Before("execution(* com.princehan.service.UserServiceImpl.*(..))")
    public void before() {
        System.out.println("执行方法前");
    }

    @After("execution(* com.princehan.service.UserServiceImpl.*(..))")
    public void after() {
        System.out.println("执行方法后");
    }

    @AfterReturning("execution(* com.princehan.service.UserServiceImpl.*(..))")
    public void afterReturning() {
        System.out.println("afterReturning");
    }

    @Around("execution(* com.princehan.service.UserServiceImpl.*(..))")
    public void around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("环绕前");
        pjp.proceed();
        System.out.println("环绕后");
    }
}
